<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateNoticeAdmin extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('notice_admin', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->unsignedInteger('admin_id')->comment('通知接受方的id');
            $table->unsignedTinyInteger('type')->comment('通知类型');
            $table->text('content')->comment('通知内容');
            $table->json('extension')->comment('通知扩展字段,根据type');
            $table->unsignedTinyInteger('status')->default(0)->comment('通知状态 0:未读 1已读');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('notice_admin');
    }
}
